 <template>
  <div class="enterprice-container">
    <div class="title">企业信息</div>
    <div class="data">
      <div>
        <span>企业名称</span>
        <span>{{enterprice.infoName}}</span>
      </div>
      <div>
        <span>企业简称</span>
        <span>{{enterprice.infoAbb}}</span>
      </div>
      <div>
        <span>统一执照信用代码</span>
        <span>{{enterprice.infoLisenceSn}}</span>
      </div>
      <div>
        <span>营业期限</span>
        <span>{{ enterprice.infoIsPerpetual ? '永久' :enterprice.infoEndDate}}</span>
      </div>
      <div>
        <span>营业执照</span>
        <img
          @click="reviewImage(enterprice.infoLisenceImg)"
          class="image"
          :src="downImgHost + '/' + enterprice.infoLisenceImg"
          alt
        >
      </div>
      <div>
        <span>企业经营范围</span>
        <span>{{enterprice.infoScope}}</span>
      </div>
      <div>
        <span>单位所在地</span>
        <span>{{enterprice.infoLocProvinceName || '无'}} / {{enterprice.infoLocCityName || '无'}} / {{enterprice.infoLocDistrictName || '无'}}</span>
      </div>
      <div>
        <span>单位所在详细地址</span>
        <span>{{enterprice.infoLocAddress}}</span>
      </div>
    </div>

    <div class="title">法人代表</div>
    <div class="data">
      <div>
        <span>法人身份证号</span>
        <span>{{enterprice.elpCcSn}}</span>
      </div>
      <div>
        <span>证件有效期</span>
        <span>{{enterprice.elpCcIsPerpetual ? '永久' : enterprice.elpCcEndDate}}</span>
      </div>
      <div>
        <span>法人身份证正面</span>
        <img
          @click="reviewImage(enterprice.elpCcImgFont)"
          class="image"
          :src="downImgHost + '/' + enterprice.elpCcImgFont"
          alt
        >
      </div>
      <div>
        <span>法人身份证背面</span>
        <img
          @click="reviewImage(enterprice.elpCcImgEnd)"
          class="image"
          :src="downImgHost + '/' + enterprice.elpCcImgEnd"
          alt
        >
      </div>
    </div>

    <div class="title">企业账户信息</div>
    <div class="data">
      <div>
        <span>企业支付宝</span>
        <span>{{enterprice.accAlipay}}</span>
      </div>
      <div>
        <span>企业开户银行</span>
        <span>{{enterprice.accBankBankName}}</span>
      </div>
      <div>
        <span>地区</span>
        <span>{{enterprice.accBankProvinceName || '无'}} / {{enterprice.accBankCityName || '无'}}</span>
      </div>
      <div>
        <span>开户支行</span>
        <span>{{enterprice.accBankBranchName}}</span>
      </div>
      <div>
        <span>银行开户名</span>
        <span>{{enterprice.accBankName}}</span>
      </div>
      <div>
        <span>对公银行账号</span>
        <span>{{enterprice.accBankSn}}</span>
      </div>
    </div>

    <TImage
      :objectUrl="downImgHost + '/' + objectUrl"
      :dislogVisible="dislogVisible"
      :handleClose="handleClose"
    ></TImage>
  </div>
</template>

<script>
import { getOrganizationById } from "api/profile";

import { formatDateTime } from "src/util/time";
import { downImgHost } from "src/config/env";

import TImage from "src/components/review/image.vue";
export default {
  data() {
    return {
      downImgHost: downImgHost,
      enterprice: "",
      objectUrl: "",
      dislogVisible: false
    };
  },
  mounted() {
    let id = this.$route.params.id;
    this.checkDetail(id);
  },
  components: { TImage },
  methods: {
    checkDetail: function(id) {
      this.dialogVisible = true;
      getOrganizationById(id).then(res => {
        res.elpCcEndDate = formatDateTime(res.elpCcEndDate);
        res.infoEndDate = formatDateTime(res.infoEndDate);
        this.enterprice = res;
      });
    },
    reviewImage: function(url) {
      this.dislogVisible = true;
      this.objectUrl = url;
    },

    handleClose(done) {
      this.dislogVisible = false;
    }
  }
};
</script>

<style lang="scss" scoped>
@import "src/style/mixin";

.enterprice-container {
  margin: 20px 0 0 50px;

  .title {
    @include sc(16px, #000);
    margin: 10px 0;
  }
  .data > div {
    margin-bottom: 30px;
  }
  .data > div > span {
    @include sc(14px, #111);
    margin-right: 30px;
  }
  .data > div > span:first-child {
    @include sc(14px, #aaa);
    width: 130px;
    text-align: right;
    display: inline-block;
  }

  .image {
    height: 100px;
  }
}
</style>
